from django.conf.urls import url

from . import views

urlpatterns = [
    url(r'^register/$', views.RegisterView.as_view()),

    # 2.判断用户名是否重复
    url(r'^usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/$', views.UsernameCountView.as_view()),

    # 3.判断手机号是否重复
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$', views.MobileCountView.as_view()),

    # 4.用户登录
    url(r'^login/$', views.LoginView.as_view(), name='login'),

    # 5.退出 logout/
    url(r'^logout/$', views.LogOutView.as_view(), name='logout'),

    # 6.用户中心
    url(r'^info/$', views.UserInfoView.as_view(), name='info'),

    # 7.保存邮箱
    url(r'^emails/$', views.EmailView.as_view(), name='email'),

    # 8.激活邮箱
    url(r'^emails/verification/$', views.EmailVerifyView.as_view(), name='verify'),

    # 9.展示 收货地址
    url(r'^address/$', views.AddressView.as_view(), name='address'),

    # 10.增加收货地址
    url(r'^addresses/create/$', views.CreateAddressView.as_view()),
    # 12.保存用户记录
    url(r'^browse_histories/$', views.UserBrowserView.as_view(), name='verify'),

    # 13.忘记密码
    url(r'^find_password/$', views.FindPasswordView.as_view()),

    # 14.验证用户是否存在
    url(r'^accounts/(?P<username>[a-zA-Z0-9_-]{5,20})/sms/token/$', views.FindUsernameView.as_view()),

    # 15.获取短信验证码
    url(r'^find_password_sms_codes/(?P<mobile>1[3-9]\d{9})/$', views.GetMessageView.as_view()),

    # 16.提交短信验证码
    url(r'^accounts/(?P<mobile>[a-zA-Z0-9_-]{5,20})/password/token/$', views.PushView.as_view()),

    # 17.提交新密码
    url(r'^users/(?P<user_id>\d+)/new_password/$', views.PushNewpwdView.as_view()),
]